home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / windows / misc / isisdrdm.arj / SETUP.BAK < prev    next >
Text File  |  1993-11-30  |  22KB  |  715 lines

  1. '**************************************************************************
  2. '*                       ISIS/Draw 1.1 Setup Toolkit
  3. '**************************************************************************
  4.  
  5. '$INCLUDE 'setupapi.inc'
  6. '$INCLUDE 'msdetect.inc'
  7. '$INCLUDE 'msregdb.inc'
  8.  
  9. ''Dialog ID's
  10. CONST SetupDrawDrwstartBillboard   = 1500
  11. CONST SetupDrawBadPath             = 1300
  12. CONST SetupDrawCheckSpace          = 1310
  13. CONST SetupDrawCustomInstall       = 1320
  14. CONST SetupDrawExitFail            = 1330
  15. CONST SetupDrawExitQuit            = 1340
  16. CONST SetupDrawExitSuccess         = 1350
  17. CONST SetupDrawGetDestPath         = 1360
  18. CONST SetupDrawHelp                = 1370
  19. CONST SetupDrawInstall             = 1380
  20. CONST SetupDrawOverwriteDestFiles  = 1390
  21. CONST SetupDrawOverwriteWinFiles   = 1400
  22. CONST SetupDrawQuit                = 1410
  23. CONST SetupDrawTooBig              = 1420
  24. CONST SetupDrawWelcome             = 1430
  25. CONST SetupDrawFoundOldHelp        = 1600
  26.  
  27. ''Bitmap ID
  28. CONST LOGO         = 5
  29.  
  30. ''File Types
  31. CONST DRAWFILES     = 1
  32. CONST HELPFILES     = 2
  33. CONST SAMPLEFILES   = 3
  34. CONST TEMPLFILES    = 4
  35.  
  36. ''ERROR Codes
  37. CONST STFFILEIO     = 8
  38.  
  39. GLOBAL DEST$        ''Default destination directory.
  40. GLOBAL HELPDIR$     ''ISIS Help dirrectory.
  41. GLOBAL WINDIR$      ''Windows directory.
  42. GLOBAL WINDRIVE$    ''Windows drive letter.
  43. GLOBAL HELPOPT$     ''Option selection from HELPFILES option dialog.
  44. GLOBAL SAMPLEOPT$   ''Option selection from SAMPLEFILES option dialog.
  45. GLOBAL TEMPLOPT$    ''Option selection from TEMPLFILES option dialog.
  46.  
  47. ''CustInst list symbol names
  48. GLOBAL DRAWNEEDS$    ''Option list costs per drive
  49. GLOBAL HELPNEEDS$
  50. GLOBAL SAMPLENEEDS$
  51. GLOBAL TEMPLNEEDS$
  52. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  53. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  54.  
  55. GLOBAL DELETEHELP$
  56. GLOBAL SAVECONFIG$
  57. GLOBAL ALLON$
  58. GLOBAL OPTIONSELECTED$
  59. GLOBAL DESTEXIST%
  60. GLOBAL WINEXIST%
  61.  
  62. ''Dialog list symbol names
  63. GLOBAL CHECKSTATES$
  64. GLOBAL STATUSTEXT$
  65. GLOBAL DRIVETEXT$
  66.  
  67. DECLARE SUB AddSelectedFilesToCopyList (ftype%)
  68. DECLARE SUB AddOptFilesToCopyList (ftype%)
  69. DECLARE SUB RecalcOptFiles (ftype%)
  70. DECLARE SUB RecalcPath
  71. DECLARE SUB SetDriveStatus
  72. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  73.  
  74.  
  75.  
  76. INIT:
  77.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  78.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  79.  
  80.     SetBitmap CUIDLL$, LOGO
  81.     SetTitle "ISIS/Draw 1.1 Setup"
  82.  
  83.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  84.     IF szInf$ = "" THEN
  85.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  86.     END IF
  87.     ReadInfFile szInf$
  88.  
  89.     WINDIR$ = GetWindowsDir()
  90.     WINDRIVE$ = MID$(WINDIR$, 1, 1)
  91.     DEST$ = WINDRIVE$ + ":\ISIS"
  92.  
  93.     ALLON$ = "YES"
  94.     SAVECONFIG$ = "NO"
  95.     DELETEHELP$ = "NO"
  96.     OPTIONSELECTED$ = "NO"
  97.  
  98.     ''CustInst list symbols
  99.     CHECKSTATES$ = "CheckItemsState"
  100.     STATUSTEXT$  = "StatusItemsText"
  101.     DRIVETEXT$   = "DriveStatusText"
  102.  
  103.     FOR i% = 1 TO 4 STEP 1
  104.         AddListItem CHECKSTATES$, "ON"
  105.     NEXT i%
  106.     FOR i% = 1 TO 4 STEP 1
  107.         AddListItem STATUSTEXT$, ""
  108.     NEXT i%
  109.     FOR i% = 1 TO 7 STEP 1
  110.         AddListItem DRIVETEXT$, ""
  111.     NEXT i%
  112.     ReplaceListItem DRIVETEXT$, 7, DEST$
  113.  
  114.     ''Disk cost list symbols
  115.     DRAWNEEDS$   = "DrawNeeds"
  116.     HELPNEEDS$   = "HelpNeeds"
  117.     SAMPLENEEDS$ = "SampleNeeds"
  118.     TEMPLNEEDS$  = "TemplNeeds"
  119.     EXTRACOSTS$  = "ExtraCosts"
  120.     BIGLIST$     = "BigList"
  121.  
  122.     FOR i% = 1 TO 4 STEP 1
  123.         AddListItem BIGLIST$, ""
  124.     NEXT i%
  125.     FOR i% = 1 TO 26 STEP 1
  126.         AddListItem EXTRACOSTS$, "0"
  127.     NEXT i%
  128.  
  129.     ''File Option Variables
  130.     HELPOPT$ = "1"
  131.     SAMPLEOPT$ = "1"
  132.     TEMPLOPT$ = "1"
  133.  
  134. WELCOME:
  135.     SetSymbolValue "EditTextIn", DEST$
  136.     SetSymbolValue "EditFocus", "END"
  137. WELCOME1:
  138.     sz$ = UIStartDlg(CUIDLL$, SetupDrawWelcome, "FEditDlgProc", SetupDrawHelp, HELPPROC$)
  139.  
  140.     IF sz$ = "CONTINUE" THEN
  141.         olddest$ = DEST$
  142.         DEST$ = GetSymbolValue("EditTextOut")
  143.  
  144.         ''Validate new path.
  145.         IF IsDirWritable(DEST$) = 0 THEN
  146.             GOSUB BADPATH
  147.             GOTO WELCOME
  148.         END IF
  149.         UIPop 1
  150.  
  151.         ''Truncate display if too long.
  152.         IF LEN(DEST$) > 23 THEN
  153.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  154.         ELSE
  155.             ReplaceListItem DRIVETEXT$, 7, DEST$
  156.         END IF
  157.  
  158.         ''Recalc if path changed.
  159.         RecalcPath
  160.         SetDriveStatus
  161.         ''Install only if it will fit.
  162.         FOR i% = 1 TO 4 STEP 1
  163.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  164.                 GOSUB TOOBIG
  165.                 olddest$ = ""
  166.                 GOTO CUSTINST
  167.             END IF
  168.         NEXT i%
  169.  
  170.         olddest$ = ""
  171.         GOTO CUSTINST
  172.     ELSEIF sz$ = "REACTIVATE" THEN
  173.         RecalcPath
  174.         SetDriveStatus
  175.         GOTO WELCOME1
  176.     ELSEIF sz$ = "EXIT" THEN
  177.         GOSUB ASKQUIT
  178.         GOTO WELCOME1
  179.     ELSE
  180.         UIPop 1
  181.         GOTO CUSTINST
  182.     END IF
  183.  
  184. CHECKCFG:
  185.  
  186.     fName$ = GetSectionKeyFilename("DrawFiles", "ISIS/Draw Configuration File")
  187.     WINEXIST% = DoesFileExist(MakePath(WINDIR$,fName$),femExists)
  188.     DESTEXIST% = DoesFileExist(MakePath(DEST$,fName$),femExists)
  189.  
  190.     IF WINEXIST% = 1 OR DESTEXIST% = 1 THEN
  191.         IF WINEXIST% = 1 THEN
  192.             sz$ = UIStartDlg(CUIDLL$, SetupDrawOverwriteWinFiles, "FInfoDlgProc", SetupDrawHelp, HELPPROC$)
  193.         ELSE
  194.             sz$ = UIStartDlg(CUIDLL$, SetupDrawOverwriteDestFiles, "FInfoDlgProc", SetupDrawHelp, HELPPROC$)
  195.         END IF
  196.         IF sz$ = "CONTINUE" THEN
  197.             SAVECONFIG$ = "YES"
  198.             UIPop 1
  199.             RETURN
  200.         ELSEIF sz$ = "BACK" THEN
  201.             SAVECONFIG$ = "NO"
  202.             UIPop 1
  203.             RETURN
  204.         ELSE
  205.             GOSUB ASKQUIT
  206.             GOTO CHECKCFG
  207.         ENDIF
  208.     ELSE
  209.         UIPop 1
  210.         RETURN
  211.     END IF
  212.  
  213. CHECKSELECTION:
  214.     FOR i% = 1 TO 4 STEP 1
  215.         IF GetListItem(CHECKSTATES$, i%) = "ON" THEN
  216.             OPTIONSELECTED$ = "YES"
  217.             RETURN
  218.         END IF
  219.     NEXT i%
  220.     GOTO QUIT
  221.  
  222.  
  223. CHECKHELP:
  224.  
  225.     ''Check for old Helps
  226.     HELPDIR$ = MakePath(DEST$,"HELP")
  227.     HELPDIREXIST% = DoesDirExist(HELPDIR$)
  228.  
  229.     IF HELPDIREXIST% = 1 THEN
  230.         sz$ = UIStartDlg(CUIDLL$, SetupDrawFoundOldHelp, "FInfoDlgProc", SetupDrawHelp, HELPPROC$)
  231.  
  232.         IF sz$ = "CONTINUE" THEN
  233.             DELETEHELP$ = "YES"
  234.             UIPop 1
  235.             RETURN
  236.         ELSE
  237.             UIPopAll
  238.             ERROR STFQUIT
  239.         END IF
  240.     ELSE
  241.         UIPop 1
  242.         RETURN
  243.     END IF
  244.  
  245. CUSTINST:
  246.     sz$ = UIStartDlg(CUIDLL$, SetupDrawCustomInstall, "FCustInstDlgProc", SetupDrawHelp, HELPPROC$)
  247.  
  248.     IF sz$ = "CONTINUE" THEN
  249.         ''Install only if it will fit.
  250.         IF VAL(GetListItem(DRIVETEXT$, 2)) > VAL(GetListItem(DRIVETEXT$, 3)) THEN
  251.             GOSUB TOOBIG
  252.             GOTO CUSTINST
  253.         ELSE
  254.             FOR i% = 1 TO 4 STEP 1
  255.                 IF GetListItem(BIGLIST$, i%) <> "" THEN
  256.                     GOSUB TOOBIG
  257.                     GOTO CUSTINST
  258.                 END IF
  259.             NEXT i%
  260.         END IF
  261.         UIPop 1
  262.         GOTO INSTALL
  263.     ELSEIF sz$ = "PATH" THEN
  264.         UIPop 1
  265.         GOSUB GETPATH
  266.         GOTO CUSTINST
  267.     ELSEIF sz$ = "CHK1" THEN
  268.         IF GetListItem(CHECKSTATES$, DRAWFILES) <> "ON" THEN
  269.             ALLON$ = "NO"
  270.         END IF
  271.         RecalcOptFiles DRAWFILES
  272.         SetDriveStatus
  273.         GOTO CUSTINST
  274.     ELSEIF sz$ = "CHK2" THEN
  275.         IF GetListItem(CHECKSTATES$, HELPFILES) <> "ON" THEN
  276.             ALLON$ = "NO"
  277.         END IF
  278.         RecalcOptFiles HELPFILES
  279.         SetDriveStatus
  280.         GOTO CUSTINST
  281.     ELSEIF sz$ = "CHK3" THEN
  282.         IF GetListItem(CHECKSTATES$, SAMPLEFILES) <> "ON" THEN
  283.             ALLON$ = "NO"
  284.         END IF
  285.         RecalcOptFiles SAMPLEFILES
  286.         SetDriveStatus
  287.         GOTO CUSTINST
  288.     ELSEIF sz$ = "CHK4" THEN
  289.         IF GetListItem(CHECKSTATES$, TEMPLFILES) <> "ON" THEN
  290.             ALLON$ = "NO"
  291.         END IF
  292.         RecalcOptFiles TEMPLFILES
  293.         SetDriveStatus
  294.         GOTO CUSTINST
  295.     ELSEIF sz$ = "BTN1" THEN
  296.         IF ALLON$ = "NO" THEN
  297.             ALLON$ = "YES"
  298.             FOR i% = 1 TO 4 STEP 1
  299.                 ReplaceListItem CHECKSTATES$, i%, "ON"
  300.             NEXT i%
  301.             RecalcPath
  302.             SetDriveStatus
  303.         END IF
  304.         GOTO CUSTINST
  305.     ELSEIF sz$ = "REACTIVATE" THEN
  306.         RecalcPath
  307.         SetDriveStatus
  308.         GOTO CUSTINST
  309.     ELSE
  310.         GOSUB ASKQUIT
  311.         GOTO CUSTINST
  312.     END IF
  313.  
  314.  
  315. INSTALL:
  316.     GOSUB CHECKSELECTION
  317.     GOSUB CHECKCFG
  318.     IF GetListItem(CHECKSTATES$, HELPFILES) = "ON" THEN
  319.         GOSUB CHECKHELP
  320.     END IF
  321.     ClearCopyList
  322.     ClearBillboardList
  323.     fTick& = 100
  324.     AddToBillboardList CUIDLL$, SetupDrawDrwstartBillboard, "FModelessDlgProc", fTick&
  325.     AddOptFilesToCopyList DRAWFILES
  326.     AddOptFilesToCopyList HELPFILES
  327.     AddOptFilesToCopyList SAMPLEFILES
  328.     AddOptFilesToCopyList TEMPLFILES
  329.     CreateDir DEST$, cmoNone
  330.     CreateDir MakePath(DEST$,"DRWSTART"), cmoNone
  331.     IF DELETEHELP$ = "YES" THEN
  332.         BASEHLPFILE$ = MakePath(HELPDIR$,"isisbase.hlp")
  333.         BASEIMGFILE$ = MakePath(HELPDIR$,"isisbase.img")
  334.         DRAWHLPFILE$ = MakePath(HELPDIR$,"isisdraw.hlp")
  335.         DRAWIMGFILE$ = MakePath(HELPDIR$,"isisdraw.img")
  336.         IF DoesFileExist(DRAWHLPFILE$,femExists) THEN
  337.             KILL DRAWHLPFILE$
  338.         END IF
  339.         IF DoesFileExist(DRAWIMGFILE$,femExists) THEN
  340.             KILL DRAWIMGFILE$
  341.         END IF
  342.     END IF
  343.     IF SAVECONFIG$ = "YES" THEN
  344.         fName$ = GetSectionKeyFilename("DrawFiles", "ISIS/Draw Configuration File 1")
  345.         SPLITPATH fname$, drv$, dir$, filename$, ext$
  346.         backupname$ = filename$ + ".sav"
  347.         IF WINEXIST% = 1 THEN
  348.             tplsavname$ = MakePath(WINDIR$,backupname$)
  349.             IF DoesFileExist(tplsavname$,femExists) THEN
  350.                 KILL tplsavname$
  351.             END IF
  352.             BackupFile MakePath(WINDIR$,fName$), backupname$
  353.         ELSEIF DESTEXIST% = 1 THEN
  354.             tplsavname$ = MakePath(DEST$,backupname$)
  355.             IF DoesFileExist(tplsavname$,femExists) THEN
  356.                 KILL tplsavname$
  357.             END IF
  358.             BackupFile MakePath(DEST$,fName$), backupname$
  359.         END IF
  360.         fName$ = GetSectionKeyFilename("DrawFiles", "ISIS/Draw Configuration File 2")
  361.         SPLITPATH fname$, drv$, dir$, filename$, ext$
  362.         backupname$ = filename$ + ".sav"
  363.         IF WINEXIST% = 1 THEN
  364.             tplsavname$ = MakePath(WINDIR$,backupname$)
  365.             IF DoesFileExist(tplsavname$,femExists) THEN
  366.                 KILL tplsavname$
  367.             END IF
  368.             BackupFile MakePath(WINDIR$,fName$), backupname$
  369.         ELSEIF DESTEXIST% = 1 THEN
  370.             tplsavname$ = MakePath(DEST$,backupname$)
  371.             IF DoesFileExist(tplsavname$,femExists) THEN
  372.                 KILL tplsavname$
  373.             END IF
  374.             BackupFile MakePath(DEST$,fName$), backupname$
  375.         END IF
  376.     ENDIF
  377.     SetCopyGaugePosition 160,30
  378.     CopyFilesInCopyList
  379.  
  380.  
  381.     IF GetListItem(CHECKSTATES$, DRAWFILES) = "ON" THEN
  382.         CreateProgmanGroup "ISIS", "", cmoNone
  383.         ShowProgmanGroup  "ISIS", 1, cmoNone
  384.         CreateProgmanItem "ISIS", "ISIS/Draw 1.1", MakePath(DEST$,"isisdraw.exe"), "", cmoOverwrite
  385.  
  386.         CreateRegKeyValue "ISISServer\protocol\StdFileEditing\server", MakePath(DEST$,"ISISDRAW.EXE")
  387.         CreateRegKeyValue "ISISServer\protocol\StdFileEditing\verb\0", "Edit"
  388.         CreateRegKeyValue "ISISServer", "ISIS/Draw Sketch"
  389.         CreateRegKeyValue ".skc", "ISISServer"
  390.  
  391.     END IF
  392.  
  393.  
  394. QUIT:
  395.     ON ERROR GOTO ERRQUIT
  396.  
  397.     IF ERR = 0 THEN
  398.         dlg% = SetupDrawExitSuccess
  399.     ELSEIF ERR = STFQUIT OR ERR = STFERR THEN
  400.         dlg% = SetupDrawExitQuit
  401.     ELSEIF ERR = STFFILEIO THEN
  402.         dlg% = SetupDrawExitQuit
  403.     ELSE
  404.         dlg% = SetupDrawExitFail
  405. ''          dlg% = SetupDrawExitQuit
  406.     END IF
  407. QUITL1:
  408.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  409.     IF sz$ = "REACTIVATE" THEN
  410.         GOTO QUITL1
  411.     END IF
  412.     UIPop 1
  413.  
  414.     END
  415.  
  416. ERRQUIT:
  417.     i% = DoMsgBox("Setup sources were corrupted, call MDL Technical Support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  418.     END
  419.  
  420.  
  421.  
  422. GETPATH:
  423.     SetSymbolValue "EditTextIn", DEST$
  424.     SetSymbolValue "EditFocus", "END"
  425. GETPATHL1:
  426.     sz$ = UIStartDlg(CUIDLL$, SetupDrawGetDestPath, "FEditDlgProc", SetupDrawHelp, HELPPROC$)
  427.  
  428.     IF sz$ = "CONTINUE" THEN
  429.         olddest$ = DEST$
  430.         DEST$ = GetSymbolValue("EditTextOut")
  431.  
  432.         ''Validate new path.
  433.         IF IsDirWritable(DEST$) = 0 THEN
  434.             GOSUB BADPATH
  435.             GOTO GETPATH
  436.         END IF
  437.         UIPop 1
  438.  
  439.         ''Truncate display if too long.
  440.         IF LEN(DEST$) > 23 THEN
  441.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  442.         ELSE
  443.             ReplaceListItem DRIVETEXT$, 7, DEST$
  444.         END IF
  445.  
  446.         ''Recalc if path changed.
  447.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  448.             sz$ = UIStartDlg(CUIDLL$, SetupDrawCheckSpace, "FModelessDlgProc", 0, "")
  449.             RecalcPath
  450.             SetDriveStatus
  451.             ''Install only if it will fit.
  452.             FOR i% = 1 TO 4 STEP 1
  453.                 IF GetListItem(BIGLIST$, i%) <> "" THEN
  454.                     GOSUB TOOBIG
  455.                     GOTO GETPATHL1
  456.                 END IF
  457.             NEXT i%
  458.             UIPop 1
  459.         END IF
  460.  
  461.         olddest$ = ""
  462.         RETURN
  463.     ELSEIF sz$ = "REACTIVATE" THEN
  464.         RecalcPath
  465.         SetDriveStatus
  466.         GOTO GETPATHL1
  467.     ELSEIF sz$ = "EXIT" THEN
  468.         GOSUB ASKQUIT
  469.         GOTO GETPATHL1
  470.     ELSE
  471.         IF olddest$ <> "" THEN
  472.             DEST$ = olddest$
  473.         END IF
  474.         UIPop 1
  475.         RETURN
  476.     END IF
  477.  
  478. TOOBIG:
  479.     sz$ = UIStartDlg(CUIDLL$, SetupDrawTooBig, "FInfo0DlgProc", 0, "")
  480.     IF sz$ = "REACTIVATE" THEN
  481.         RecalcPath
  482.         SetDriveStatus
  483.         GOTO TOOBIG
  484.     END IF
  485.     UIPop 1
  486.     RETURN
  487.  
  488. BADPATH:
  489.     sz$ = UIStartDlg(CUIDLL$, SetupDrawBadPath, "FInfo0DlgProc", 0, "")
  490.     IF sz$ = "REACTIVATE" THEN
  491.         RecalcPath
  492.         SetDriveStatus
  493.         GOTO BADPATH
  494.     END IF
  495.     UIPop 1
  496.     RETURN
  497.  
  498. ASKQUIT:
  499.     sz$ = UIStartDlg(CUIDLL$, SetupDrawQuit, "FQuitDlgProc", 0, "")
  500.  
  501.     IF sz$ = "EXIT" THEN
  502.         UIPopAll
  503.         ERROR STFQUIT
  504.     ELSEIF sz$ = "REACTIVATE" THEN
  505.         GOTO ASKQUIT
  506.     ELSE
  507.         UIPop 1
  508.     END IF
  509.     RETURN
  510.  
  511. '**
  512. '** Purpose:
  513. '**     Adds the PL option files to the copy list.
  514. '** Arguments:
  515. '**     ftype%  - type of files to add, one of the following:
  516. '**             PLFILES
  517. '** Returns:
  518. '**     none.
  519. '*************************************************************************
  520. SUB AddSelectedFilesToCopyList (ftype%) STATIC
  521.  
  522.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  523.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  524.         IF ftype% = PLFILES THEN
  525.             lLen% = GetListLength(LISTOUT$)
  526.             PlDest$ = MakePath (DEST$, "DRWSTART")
  527.             FOR i% = 1 TO lLen% STEP 1
  528.                 fName$ = GetListItem(LISTOUT$, i%)
  529.                 AddSectionKeyFileToCopyList "PlFiles", fName$ , SrcDir$, PlDest$
  530.             NEXT i%
  531.         END IF
  532.         SrcDir$ = ""
  533.     END IF
  534. END SUB
  535.  
  536.  
  537. '**
  538. '** Purpose:
  539. '**     Adds the specified option files to the copy list.
  540. '** Arguments:
  541. '**     ftype%  - type of files to add, one of the following:
  542. '**             DRAWFILES, HELPFILES, PLFILES, SAMPLEFILES, TEMPLFILES
  543. '** Returns:
  544. '**     none.
  545. '*************************************************************************
  546. SUB AddOptFilesToCopyList (ftype%) STATIC
  547.  
  548.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  549.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  550.         IF ftype% = DRAWFILES THEN
  551.             AddSectionKeyFileToCopyList "DrawFiles", "ISIS/Draw Executable", SrcDir$, DEST$
  552. '*            AddSectionKeyFileToCopyList "DrawFiles", "ISIS/Draw Support Files", SrcDir$, DEST$
  553.             IF DESTEXIST% = 1 AND WINEXIST% = 0 THEN
  554.                 AddSectionKeyFileToCopyList "DrawFiles", "ISIS/Draw Configuration File 1", SrcDir$, DEST$
  555.             ELSE
  556.                 AddSectionKeyFileToCopyList "DrawFiles", "ISIS/Draw Configuration File 1", SrcDir$, WINDIR$
  557.             END IF
  558.             IF DESTEXIST% = 1 AND WINEXIST% = 0 THEN
  559.                 AddSectionKeyFileToCopyList "DrawFiles", "ISIS/Draw Configuration File 2", SrcDir$, DEST$
  560.             ELSE
  561.                 AddSectionKeyFileToCopyList "DrawFiles", "ISIS/Draw Configuration File 2", SrcDir$, WINDIR$
  562.             END IF
  563.         ELSEIF ftype% = HELPFILES THEN
  564.             AddSectionFilesToCopyList "HelpFiles", SrcDir$, DEST$
  565.         ELSEIF ftype% = SAMPLEFILES THEN
  566.             AddSectionFilesToCopyList "SampleFiles", SrcDir$, DEST$
  567.         ELSEIF ftype% = TEMPLFILES THEN
  568.             AddSectionFilesToCopyList "TemplFiles", SrcDir$, DEST$
  569.         END IF
  570.         SrcDir$ = ""
  571.     END IF
  572. END SUB
  573.  
  574.  
  575. '**
  576. '** Purpose:
  577. '**     Recalculates disk space for the given option files and sets
  578. '**     the status info symbol "StatusItemsText".
  579. '** Arguments:
  580. '**     ftype% - type of files to add, one of the following:
  581. '**             DRAWFILES, HELPFILES, PLFILES, SAMPLEFILES
  582. '** Returns:
  583. '**     none.
  584. '*************************************************************************
  585. SUB RecalcOptFiles (ftype%) STATIC
  586.     CursorSave% = ShowWaitCursor()
  587.     ClearCopyList
  588.     AddOptFilesToCopyList ftype%
  589.  
  590.     fExtra% = 0
  591.     IF ftype% = DRAWFILES THEN
  592.         ListSym$ = DRAWNEEDS$
  593.         IF GetListItem(CHECKSTATES$, DRAWFILES) = "ON" THEN
  594.             ''Add extra cost to Windows drive for ini/progman, etc.
  595.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  596.             ReplaceListItem EXTRACOSTS$, ndrive%, "4096"
  597.             fExtra% = 1
  598.         END IF
  599.     ELSEIF ftype% = HELPFILES THEN
  600.         ListSym$ = HELPNEEDS$
  601.     ELSEIF ftype% = SAMPLEFILES THEN
  602.         ListSym$ = SAMPLENEEDS$
  603.     ELSEIF ftype% = TEMPLFILES THEN
  604.         ListSym$ = TEMPLNEEDS$
  605.     END IF
  606.  
  607.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  608.  
  609.     cost& = 0
  610.     FOR i% = 1 TO 26 STEP 1
  611.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  612.     NEXT i%
  613.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  614.  
  615.     IF StillNeed& > 0 THEN
  616.         ReplaceListItem BIGLIST$, ftype%, "YES"
  617.     ELSE
  618.         ReplaceListItem BIGLIST$, ftype%, ""
  619.     END IF
  620.  
  621.     IF fExtra% THEN
  622.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  623.     END IF
  624.     RestoreCursor CursorSave%
  625.     ListSym$ = ""
  626. END SUB
  627.  
  628.  
  629. '**
  630. '** Purpose:
  631. '**     Recalculates disk space and sets option status info according
  632. '**     to the current destination path.
  633. '** Arguments:
  634. '**     none.
  635. '** Returns:
  636. '**     none.
  637. '*************************************************************************
  638. SUB RecalcPath STATIC
  639.  
  640.     CursorSave% = ShowWaitCursor()
  641.  
  642.     RecalcOptFiles DRAWFILES
  643.     RecalcOptFiles HELPFILES
  644.     RecalcOptFiles SAMPLEFILES
  645.     RecalcOptFiles TEMPLFILES
  646.  
  647.     RestoreCursor CursorSave%
  648. END SUB
  649.  
  650.  
  651. '**
  652. '** Purpose:
  653. '**     Sets drive status info according to latest disk space calcs.
  654. '** Arguments:
  655. '**     none.
  656. '** Returns:
  657. '**     none.
  658. '*************************************************************************
  659. SUB SetDriveStatus STATIC
  660.  
  661.     drive$ = MID$(DEST$, 1, 1)
  662.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  663.     cost1& = VAL(GetListItem(DRAWNEEDS$, ndrive%)) + VAL(GetListItem(HELPNEEDS$, ndrive%))
  664.     cost2& = VAL(GetListItem(SAMPLENEEDS$, ndrive%))
  665.     cost3& = VAL(GetListItem(TEMPLNEEDS$, ndrive%))
  666.     cost& = cost1& + cost2& + cost3&
  667.     free& = GetFreeSpaceForDrive(drive$)
  668.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  669.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  670.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  671.  
  672.     IF drive$ = WINDRIVE$ THEN
  673.         ReplaceListItem DRIVETEXT$, 4, ""
  674.         ReplaceListItem DRIVETEXT$, 5, ""
  675.         ReplaceListItem DRIVETEXT$, 6, ""
  676.     ELSE
  677.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  678.         cost& = VAL(GetListItem(DRAWNEEDS$, ndrive%)) + VAL(GetListItem(HELPNEEDS$, ndrive%)) + VAL(GetListItem(SAMPLENEEDS$, ndrive%)) + VAL(GetListItem(TEMPLNEEDS$, ndrive%))
  679.         IF cost& = 0 THEN
  680.             ReplaceListItem DRIVETEXT$, 4, ""
  681.             ReplaceListItem DRIVETEXT$, 5, ""
  682.             ReplaceListItem DRIVETEXT$, 6, ""
  683.         ELSE
  684.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  685.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  686.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  687.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  688.         END IF
  689.     END IF
  690. END SUB
  691.  
  692.  
  693. '**
  694. '** Purpose:
  695. '**     Appends a file name to the end of a directory path,
  696. '**     inserting a backslash character as needed.
  697. '** Arguments:
  698. '**     szDir$  - full directory path (with optional ending "\")
  699. '**     szFile$ - filename to append to directory
  700. '** Returns:
  701. '**     Resulting fully qualified path name.
  702. '*************************************************************************
  703. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  704.     IF szDir$ = "" THEN
  705.         MakePath = szFile$
  706.     ELSEIF szFile$ = "" THEN
  707.         MakePath = szDir$
  708.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  709.         MakePath = szDir$ + szFile$
  710.     ELSE
  711.         MakePath = szDir$ + "\" + szFile$
  712.     END IF
  713. END FUNCTION
  714.  
  715.